<template>
  <div>
    Child: {{money}}
    <button @click="changeMoney(0.5)">修改 money</button>
  </div>
</template>

<script>
import { inject } from 'vue'
export default {
  name: 'Child', 
  setup() {
    // !#2 通过 inject 把数据注入过来
    const { money, changeMoney } = inject('moneyData')
    return {
      money,
      changeMoney
    }
  }
}
</script>

<style lang="scss" scoped>

</style>